package com.utils;

public class BitUtil {
    /**
     * 设置某个状态
     * @param num
     * @param bit
     */
    public static long setBitStatusInLong(long num, int bit)
    {
        return (num | (1l << bit));
    }

    /**
     * 清除标志位
     * @param num
     * @param bit
     */
    public static long clearBitStatusInLong(long num, int bit)
    {
        return (num & (~(1l << bit)));
    }

    /**
     * 获取某个状态位
     * @param num
     * @param bit
     * @return
     */
    public static int getBitStatusInLong(long num, int bit)
    {
        return (int) ((num >> bit) & 1l);
    }

}
